import http from "@/http"
import type { FoodTable } from "@/api/food/foodTable"

//获取菜谱信息与图片
export const getRecipeApi = (parm:FoodTable)=>{
    return http.post("/api/recipe/getform",parm)
}
//添加菜谱
export const addRecipeApi  = (parm:FoodTable)=>{
    return http.post("/api/recipe/addrecipe",parm)
}
//获取对应菜谱信息与图片
export const getRecipesApi = (parm:FoodTable)=>{
    return http.post("/api/recipe/getforms",parm)
}
//用户修改菜谱信息
export const editRecipeApi = (parm:FoodTable)=>{
    return http.post("/api/recipe/editrecipe",parm)
}
//用户删除未审核的菜谱
export const deleteRecipeApi =(cookbId:string)=>{
    return http.delete(`/api/recipe/deleterecipe/${cookbId}`)
}

//获取最新菜谱方法
export const getRecipeBytime =()=>{
    return http.get("/api/recipe/getRecipe")
}




//管理员方法
//管理员获取菜谱方法
export const adGetRecipesApi = (page:number,pageSize:number,searchQuery?:string,status?:string)=>{
    return http.get("/api/recipe/adgetforms",{ page, pageSize, searchQuery ,status})
}
//管理员批量删除菜谱的方法
//管理员批量审核菜谱的方法
export const adminEditRecipeListApi = (recipelist:FoodTable[],adminId:string)=>{
    return http.post("/api/recipe/editrecipelist",{recipelist,adminId})
}
